package cn.faster.common.utils.sys.shiro;

import cn.faster.common.constants.ShiroConstants;
import org.springframework.stereotype.Component;

import java.util.Random;

/**
 * description: ShiroSaltUtils
 * date: 2021/6/10 11:16
 * author: XiaoCoder
 * version: 1.0
 */
public class ShiroSaltUtils {
    public static String getSalt(int i){
        char[] chars = ShiroConstants.SHIRO_SALT_RANDOM_STRING.toCharArray();
        StringBuilder stringBuilder = new StringBuilder();
        for (int i1 = 0; i1 < i; i1++) {
            char aChar = chars[new Random().nextInt(chars.length)];
            stringBuilder.append(aChar);
        }
        return stringBuilder.toString();
    }
}
